package com.atguigu.gmall.cart.rpc;

import com.atguigu.gmall.cart.service.CartService;
import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.common.util.AuthUtil;
import com.atguigu.gmall.model.cart.CartItem;
import com.atguigu.gmall.model.to.UserAuthTo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author 卡尼奶
 * @Date 2022/6/1 20:08
 * @Version 1.0
 */
@RestController
@RequestMapping("/rpc/inner")
public class CartRpcController {

    @Autowired
    private CartService cartService;

    @PostMapping("/addToCart/{skuId}")
    public Result<CartItem> addToCart(@PathVariable("skuId")Long skuId,
                                      @RequestParam("skuNum")Integer skuNum){

        CartItem cartItem = cartService.addToCart(skuId,skuNum);
        return Result.ok(cartItem);
    }
}
